﻿
using GCC.APIContainer.Auth.Filter;

using Microsoft.AspNetCore.Mvc;

namespace GCC.APIContainer.Auth.Attributes
{

    /// <summary>
    /// 权限过滤特性
    /// </summary>
    [AttributeUsage(AttributeTargets.Method)]
    public class GCCAuthAttribute : TypeFilterAttribute
    {
        /// <summary>
        /// 权限过滤特性
        /// </summary>
        /// <param name="roles">允许的角色</param>
        /// <param name="allowOffline">是否允许离线,如果允许,如果权限中心为单点登录,那么将会造成脱离单点控制,当然手动可以认证</param>
        public GCCAuthAttribute(bool allowOffline = false, params string[] roles) : base(typeof(GCCAuthFilter))
        {
            this.Arguments = new object[] { roles, allowOffline };
        }
    }
}
